/**
 * Created by admin on 2017/3/2.
 */
$(function () {

    // var arr = [];
    var jy;
    var obj = {result:[]};
    var num = 4;
    $.ajax({
        url:'http://192.168.23.25:3000/api/getinlanddiscount',
        datatype:"json",
        success:function (data) {
         jy = data;
         for( var i = 0; i<num; i++){
             obj.result.push(jy.result[i]);
         }
         var html = template('template11',obj);

            $(window).scroll(function () {
                var height =$(window).height()+$(window).scrollTop();
                if(height==$(document).height()){
                    console.log($(document).height());
                    // console.log(groups);
                    groups++;
                    if(groups>=group){
                        return;
                    }
                    html = template('template11', arr[groups]);
                    // console.log(data);
                    // 将当前点击的p标签对应的ul的内容设置为html
                    $(".zhekou").append(html);
                }
            })
        }
    })
});
